//
//  ZYMainController.m
//  Joynet
//
//  Created by admin on 2017/7/24.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "ZYMainController.h"

#import "ZYHomeController.h"
#import "WYMediaLibraryController.h"
#import "WYSendAdvertiseController.h"
#import "WYRecommendController.h"
#import "WYLoginController.h"
#import "WYPersonalController.h"
@interface ZYMainController ()

@end

@implementation ZYMainController

- (void)viewDidLoad {
    [super viewDidLoad];
     [self setupAllChildViewControllers];
     self.tabBar.barTintColor=[UIColor hexStringToColor:@"ffffff" alpha:1.0];
    // Do any additional setup after loading the view.
}
- (void)setupAllChildViewControllers {
    
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                       [UIColor grayColor], NSForegroundColorAttributeName,
                                                       nil] forState:UIControlStateNormal];
    
    UIColor *titleHighlightedColor = [UIColor blueColor];
    [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:titleHighlightedColor, NSForegroundColorAttributeName,nil] forState:UIControlStateSelected];
    ZYHomeController *vc=[[ZYHomeController alloc]init];
    //vc.view.backgroundColor = [UIColor orangeColor];
    [self setupChildViewController:vc title:@"首页" imageName:@"icon_tabbar_home_normal" selectedImageName:@"icon_tabbar_home_select"];
    //    }else{
    //        //_shouYeLoginView=[[shouYeLoginViewController alloc]init];
    //        shouYeNoLoginViewController *nvc=[[shouYeNoLoginViewController alloc]init];
    //        [self setupChildViewController:nvc title:@"首页" imageName:@"icon_tabbar_home_normol" selectedImageName:@"icon_tabbar_home_height"];
    //    }
    
    
//    WYTestController *vc1=[[WYTestController alloc]init];
//    [self setupChildViewController:vc1 title:@"代客下单" imageName:@"palce_normal" selectedImageName:@"palce_selected"];
    
    /*
     _findView=[[WYFindGoldController alloc]init];
     [self setupChildViewController:_findView title:@"找乐圆" imageName:@"icon_tabbar_jifen_normal" selectedImageName:@"icon_tabbar_jifen_height"];
     */
 //   UIViewController *vc2=[[UIViewController alloc]init];
    //LCCKConversationListViewController *firstViewController = [[LCCKConversationListViewController alloc] init];
//    [self setupChildViewController:vc2 title:@"动态" imageName:@"tabbar_dynamic_nor_27x27_" selectedImageName:@"tabbar_dynamic_selected_27x27_"];
    
    WYMediaLibraryController *pvc=[[WYMediaLibraryController alloc]init];
   // pvc.view.backgroundColor = [UIColor whiteColor];
    [self setupChildViewController:pvc title:@"媒体库" imageName:@"iocn_tabbar_media_normal" selectedImageName:@"iocn_tabbar_media_select"];
    WYSendAdvertiseController *vc2=[[WYSendAdvertiseController alloc]init];
   // vc2.view.backgroundColor  = [UIColor yellowColor];
    [self setupChildViewController:vc2 title:@"投广告" imageName:@"icon_tabbar_adver_normal" selectedImageName:@"icon_tabbar_adver_select"];
    
    WYPersonalController *vc3=[[WYPersonalController alloc]init];
  ///  vc3.view.backgroundColor = [UIColor greenColor];
    [self setupChildViewController:vc3 title:@"我的" imageName:@"icon_tabbar_me_normal" selectedImageName:@"icon_tabbar_me_select"];
    
    
}
- (void)setupChildViewController:(UIViewController *)childVc title:(NSString *)title imageName:(NSString *)imageName selectedImageName:(NSString *)selectedImageName {
    childVc.tabBarItem.title=title;
    childVc.tabBarItem.image = [UIImage imageNamed:imageName];
    UIImage *selectedIamge = [UIImage imageNamed:selectedImageName];
    childVc.tabBarItem.selectedImage = [selectedIamge imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
   // CGFloat offset = 5.0;
    
    //tabBar图片居中显示，不显示文字
    
//    childVc.tabBarItem.imageInsets = UIEdgeInsetsMake(offset, 0, -offset, 0);
    WYBaseNavigationController *navVc = [[WYBaseNavigationController alloc] initWithRootViewController:childVc];
    //navVc.navigationBar.barTintColor=[UIColor orangeColor];
    [self addChildViewController:navVc];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


@end
